package de.justphil.tcg.tcgserver.websockets.messages;

import net.jcip.annotations.Immutable;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;

//omit 'null' values when serializing to json
@Immutable
@JsonSerialize(include = Inclusion.NON_NULL)
public class TCGInfoFragment {
	
	@JsonProperty
	@JsonSerialize(include = Inclusion.NON_DEFAULT)
	private final int t;
	
	@JsonProperty
	private final String key;
	
	@JsonProperty
	private final String msg;

	public TCGInfoFragment() {
		t = 0;
		key = null;
		msg = null;
	}
	
	public TCGInfoFragment(int t, String key, String msg) {
		this.t = t;
		this.key = key;
		this.msg = msg;
	}

	@JsonIgnore
	public int getType() {
		return t;
	}

	public String getMsg() {
		return msg;
	}
	
	public class Type {
		public static final int SERVER_MIDDLEWARE_INFO = 1;
	}

	public String getKey() {
		return key;
	}
	
}
